home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Picture Viewer / Source / PictureViewerInit.cpp < prev    next >
Encoding:
Text File  |  1995-12-08  |  1.9 KB  |  76 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.     File:            PictureViewerInit.cpp
  3.  
  4.     Contains:        CFM Library init routines for PictureViewer
  5.  
  6.     Written by:        Sue Dumont
  7.  
  8.     Copyright:        © 1994,95 by Apple Computer, Inc., all rights reserved.
  9. ------------------------------------------------------------------------------*/
  10.  
  11. // -- Compiler/Preprocessor Switches --
  12.  
  13. #ifndef _COMPILERDEFS_
  14. #include "CompDefs.h"
  15. #endif
  16.  
  17. // -- OpenDoc Utilities --
  18.  
  19. #ifndef _EXCEPT_
  20. // Exceptions define several important macros (eg. CHECKENV)
  21. // which are used in the SOM method dispatch glue. If Except.h
  22. // is not included early enough, exceptions may not be thrown
  23. // correctly when returning from a SOM method with "ev" parameter set.
  24. #include <Except.h>
  25. #endif
  26.  
  27. // -- OpenDoc Utilities --
  28.  
  29. #ifndef _USERSRCM_
  30. #include <UseRsrcM.h>
  31. #endif
  32.  
  33. #ifndef _ODMEMORY_
  34. #include <ODMemory.h>
  35. #endif
  36.  
  37. // -- MacToolbox Includes --
  38.  
  39. #ifndef __CODEFRAGMENTS__
  40. #include <CodeFragments.h>
  41. #endif
  42.  
  43. #pragma segment PictureViewerCFMInit
  44.  
  45. //------------------------------------------------------------------------------
  46. // Prototypes
  47. //------------------------------------------------------------------------------
  48.  
  49. extern "C" pascal OSErr PictureViewerCFMInit(CFragInitBlockPtr initBlkPtr);
  50.  
  51.  
  52. //------------------------------------------------------------------------------
  53. // Functions
  54. //------------------------------------------------------------------------------
  55.  
  56. extern "C" pascal OSErr PictureViewerCFMInit(CFragInitBlockPtr initBlkPtr)
  57. {
  58.     OSErr    err1, err2;
  59.     
  60.     // We are using OpenDoc's memory management calls, so we
  61.     // must initialize the interface to the memory manager.
  62.     err1 = InitODMemory();
  63.  
  64.     if ( !err1 )
  65.     {
  66.         // We must also capture the relevant information about
  67.         // our library file so that we may access our resources.
  68.         err2 = InitLibraryResources(initBlkPtr);
  69.     }
  70.  
  71.     return (OSErr) (err1 != noErr) ? err1 : err2;
  72. }
  73.  
  74.  
  75.  
  76.